home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 114 / CDRom114.iso / internet / extens / dband / Bandwidth Tester.xpi / chrome / bandwidthtest.jar / content / options.js < prev    next >
Encoding:
Text File  |  2004-09-07  |  1.7 KB  |  37 lines

  1.  
  2. function bandwidthtest_options_init(){
  3.     try{
  4.         
  5.         var oPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("");
  6.     
  7.         // Prefill
  8.         if(oPrefs.prefHasUserValue("bandwidthtest.files.1"))
  9.                 document.getElementById("file_1").value = oPrefs.getCharPref("bandwidthtest.files.1");
  10.         if(oPrefs.prefHasUserValue("bandwidthtest.files.2"))
  11.                 document.getElementById("file_2").value = oPrefs.getCharPref("bandwidthtest.files.2");
  12.         if(oPrefs.prefHasUserValue("bandwidthtest.files.3"))
  13.                 document.getElementById("file_3").value = oPrefs.getCharPref("bandwidthtest.files.3");
  14.         if(oPrefs.prefHasUserValue("bandwidthtest.files.4"))
  15.                 document.getElementById("file_4").value = oPrefs.getCharPref("bandwidthtest.files.4");
  16.         if(oPrefs.prefHasUserValue("bandwidthtest.files.5"))
  17.                 document.getElementById("file_5").value = oPrefs.getCharPref("bandwidthtest.files.5");
  18.     
  19.     }catch(e){ alert("Could not load preferences.\n"+ e); }
  20. }
  21.  
  22. function bandwidthtest_options_save(){
  23.     try{
  24.         
  25.         var oPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("");
  26.     
  27.         // Save
  28.         oPrefs.setCharPref("bandwidthtest.files.1", document.getElementById("file_1").value);
  29.         oPrefs.setCharPref("bandwidthtest.files.2", document.getElementById("file_2").value);
  30.         oPrefs.setCharPref("bandwidthtest.files.3", document.getElementById("file_3").value);
  31.         oPrefs.setCharPref("bandwidthtest.files.4", document.getElementById("file_4").value);
  32.         oPrefs.setCharPref("bandwidthtest.files.5", document.getElementById("file_5").value);
  33.     
  34.     }catch(e){ alert("Could not save preferences.\n"+ e); }
  35.     
  36.     return true;
  37. }